package com.model.location;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class Province {
	private int provinceID;
	private String provincePinyin;
	private String provinceName;
	private HashMap<String,City> cities;
	private boolean municipalities;//如果为true的话，表示为直辖市

	public Province(int provinceID,String provincePinyin,String provinceName,boolean municipalities){
		this.provinceID = provinceID;
		this.provinceName = provinceName;
		this.provincePinyin = provincePinyin;
		this.municipalities = municipalities;
		cities = new HashMap<String,City>();
	}
	
	public void addCity(City city){
		cities.put(city.getCityName(), city);
	}
	
	public City findCity(String cityName){
		return cities.get(cityName);
	}
	
	public ArrayList<String> getCityNames(){
		ArrayList<String> cityNames = new ArrayList<String>();
		Iterator<String> iterator = cities.keySet().iterator();
		while(iterator.hasNext()){
			cityNames.add(iterator.next());
		}
		return cityNames;
	}
	
	public String getProvinceName() {
		return provinceName;
	}

	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}

	public int getProvinceID() {
		return provinceID;
	}

	public void setProvinceID(int provinceID) {
		this.provinceID = provinceID;
	}
	
	public boolean isMunicipalities() {
		return municipalities;
	}

	public void setMunicipalities(boolean municipalities) {
		this.municipalities = municipalities;
	}

	public String getProvincePinyin() {
		return provincePinyin;
	}

	public void setProvincePinyin(String provincePinyin) {
		this.provincePinyin = provincePinyin;
	}
}
